
import rclpy
from rclpy.node import Node
from turtlesim.msg import Pose

class PoseListener(Node):
    def __init__(self, name):
        super().__init__(name)
        self.subscription = self.create_subscription(Pose, 'turtle1/pose', self.pose_callback, 10)
        self.subscription

    def pose_callback(self, msg):
         self.get_logger().info('Turtle pose: x = %f, y = %f, theta = %f' % (msg.x, msg.y, msg.theta))
    
def main(args=None):
    rclpy.init(args=args)
    node = PoseListener("turtle_listener")
    rclpy.spin(node)
    node.destroy_node()
    rclpy.shutdown()

if __name__ == '__main__':
    main()




